package cn.comtom.ewbs.signature.service.impl;
import cn.comtom.ewbs.signature.entity.SysUser;
import cn.comtom.ewbs.signature.mapper.SysUserMapper;
import cn.comtom.ewbs.signature.service.ISysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.comtom.ewbs.signature.common.vo.request.PageRequest;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liuhy
 * @since 2022-11-04 14:27:32
 */
@Service
@Slf4j
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
	
	@Override
	public IPage<SysUser> selectPage(SysUser sysUser, PageRequest pageReq) {
		Page<SysUser> page = new Page<SysUser>(pageReq.getPage() , pageReq.getLimit() , true);
        LambdaQueryWrapper<SysUser> wrapper = Wrappers.lambdaQuery();
        wrapper.setEntity(sysUser);
        return this.baseMapper.selectPage(page, wrapper);
	}

	@Override
	public SysUser getByAccount(String account) {
		 LambdaQueryWrapper<SysUser> wrapper = Wrappers.lambdaQuery();
		 wrapper.eq(SysUser::getAccount, account);
		 return this.getOne(wrapper);
	}
}
